import axios from 'axios';

const request = axios.create({
  baseURL: 'http://localhost:8080', // 后端API基础URL
  timeout: 5000,
});

// 响应拦截器 - 处理错误
request.interceptors.response.use(
  (response) => {
    return response.data;
  },
  (error) => {
    console.error('响应错误:', error);
    return Promise.reject(error);
  }
);

export default request;
